$(function(){
	
	$('#editForm').amValidator();
	
	$('#editForm').submit(function(){
		var validator = $(this).data('amui.validator').isFormValid(); 
        if(!validator){return false;}
        var data = $(this).amFormToJson(); 
        $.post(window.rootPath + '/sysCfg/save', data, function(r) {
        	if (r.r) { 
        		location.href = window.rootPath + "/sysCfg";
            } else {
            	alert(r.m);
            }
        }, 'json');
        return false;
    });
	
	$('#cancelBtn').click(function(){
		
		location.href = window.rootPath + "/sysCfg";
		
	});
});